QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Face Attribute Set Lists

Labels

ASCII
FaceAttributeSetList
Binary
fasl (= 0x6661736C )

Packing enum data type

PackingEnum
The permitted values are include ( = 0x00000000 )
and exclude ( = 0x00000001 ).

Data Format

Uns32               nObjects
PackingEnum         packing
Uns32               nIndices
Uns32               indices[nIndices]
nObjects
The total number of faces or facets of the parent object. If the parent object is a box, the value of this field is 6. If the parent object is a trigrid, the value of this field is the number of vertices used to define that trigrid, which is also the number of facets of the trigrid. If the parent object is a mesh, the value of this field is the number of faces of that mesh.
packing
The value of this field determines whether the facets of the parent object of the set list to receive attributes are those whose facet indices appear in the array indices[] or are those whose indices do not appear in that array. A value of include indicates the former; exclude indicates the latter. You may wish to select include if most facets of the parent object are not to receive any attributes. Should any other value appear in this field, the entire set list and all of its child objects should be ignored.
nIndices
The number of facets of the parent object to which the action specified in the packing field is to be applied; that is, the number of facets to be included in (or excluded from) the group of facets to receive attributes. The value of this field may not exceed that of the nObjects field.
indices[]
An array of facet indices. The values in the fields of this array are the indices of those facets of the parent object to be subject to the action of the value of the packing field, in the event that the number of facets to receive attributes is less than the value in the nObjects field. The size of this array must equal the value in the nIndices field. Indices are to be entered in fields of this array in increasing order; no index may appear more than once. If the value in the packing field is include , then the field values represent those facets which are to receive attributes in consequence of the set list. If the value in the packing field is exclude , then the field values represent those facets that are not to receive attributes in consequence of the set list. If the value in the packing field is exclude and the value in the nIndices field is 0, then this field may be left unspecified; similarly, if the value in the packing field is include and the value in the nIndices field is equal to the value in the nObjects field, then this field may be left unspecified.

Data Size

16 + nIndices * sizeof(Uns) + padding

Description

A face attribute set list is used to assign sets of attributes separately and selectively to one or more facets of a multi-faceted geometric object (that is, to the faces of a box or mesh, or to the triangular facets of a trigrid). A face attribute set list may not be assigned to a general polygon. The listed attribute sets themselves occur as child objects of the set list object and are correlated with facets of the parent object of the set list as described later in this section. You may think of the child objects as the items in the set list; officially, the set list is the object defined in this section.

For convenience, the packing field allows you to choose whether to specify (by inclusion) the facets to receive attributes or to specify (by exclusion) the facets not to receive attributes. The number of child objects you must specify is equal to the number of facets actually to receive attributes, whichever option you select for the packing field. You may wish to specify by inclusion rather than by exclusion if most facets are not to receive any attributes. This option can reduce the size of the indices[] array, save work, and save disk space.

If the value of the packing field of a set list is include , then the number of child objects of that set list must equal the value of the nIndices field of that set list. If the value of the packing field is exclude , then the number of child objects must equal the (absolute value of) the difference between the values of the nObjects and nIndices fields.

Child objects are correlated with facets of the parent object of the set list as follows. Let the child objects of the set list be enumerated in the order of their occurrence in the metafile. If the value of the packing field is include , then the ith child object is correlated with the facet whose index is the value of the ith field of the array indices[] , or indices[i-1] . If the value of the packing field is exclude , then the ith child object is correlated with the facet whose facet index is the i th element of the sequence (in increasing order) of facets whose indices do not appear in the array indices[] . For example, suppose that the parent object is a mesh having 17 faces, packing is set to exclude , nIndices is 11, and the elements of indices[] are 1, 2, 4, 6, 7, 8, 11, 12, 13, 14, 16. Then six facets are to receive attributes: facets 0, 3, 5, 9, 10, 15, so the set list will have six child objects c0,..., c5. The third child object (that is, c2) is correlated with facet 5, and, in general, the ith element of the sequence <c0,..., c5> is correlated with the ith element of the sequence <0, 3, 5, 9, 10, 15>.

The index used to enumerate the facets of a multifaceted geometric object is described in the section pertaining to that object. Indices begin with zero, so that the index of the i +1st facet of a multifaceted object is i . The index used to construct an attribute set list must be standard.

Parent Hierarchy

Data, attribute set list.

Parent Objects

Box, mesh, trigrid.

Child Objects

Attribute sets (required). The number of child objects is determined in the manner indicated in the description of a face attribute set list.

Example

Container (
    TriGrid (...)                               #parent object
    Container (
        FaceAttributeSetList ( )
        6                           #nObjects           (parent has six facets;
        exclude                     #packing            (exclude
        4                           #nIndices           (four of them:
        0   2   3   5               #indices[]          (these four.)
        #begin list
        Container (
            AttributeSet                                #apply to facet 1
            DiffuseColor (...)
        )
        Container (
            AttributeSet                                #apply to facet 4
            DiffuseColor (...)
        #end list
        )
    )
)

© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |